package com.qb.plugin;

import com.android.build.gradle.internal.LoggerWrapper;
import com.qb.plugin.asm.BaseWeaver;

import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;

/**
 * File: null.java
 * Creator: dingpwen
 * Company: shiwei
 * Created on: 2021/7/2 15:33
 * Email: dingpwen@gmail.com
 * Details: TODO
 */
public class CommonWeaver extends BaseWeaver {

    private static final String PLUGIN_LIBRARY = "com.qb.plugin";
    private static final LoggerWrapper logger = LoggerWrapper.getLogger(CommonWeaver.class);

    @Override
    public void setExtension(Object extension) {
    }

    @Override
    public boolean isWeavableClass(String fullQualifiedClassName) {
        boolean superResult = super.isWeavableClass(fullQualifiedClassName);
        boolean isByteCodePlugin = fullQualifiedClassName.startsWith(PLUGIN_LIBRARY);
        return superResult && !isByteCodePlugin;
    }

    @Override
    protected ClassVisitor wrapClassWriter(ClassWriter classWriter) {
        return new CommonClassVisitor(classWriter);
    }

}

